# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=wifiscanmap
pkgver=135.9adcd08
pkgrel=5
pkgdesc='Another wifi mapping tool.'
groups=('blackarch' 'blackarch-wireless' 'blackarch-scanner')
arch=('any')
url='https://github.com/mehdilauters/wifiScanMap'
license=('GPL3')
depends=('python2' 'python2-pysqlite' 'python2-rpi-gpio' 'python2-scapy'
         'aircrack-ng' 'gpsd' 'bluez' 'bower' 'python2-gps')
makedepends=('git')
source=("$pkgname::git+https://github.com/mehdilauters/wifiScanMap.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  rm README.md

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 scanmap.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

